<div class="discourse-subscriptions-section-columns">
  <div class="section-column discourse-subscriptions-confirmation-billing">
    <h2>
      {{this.model.product.name}}
    </h2>

    <hr />

    <p>
      {{html-safe this.model.product.description}}
    </p>
  </div>

  <div class="section-column">
    {{#if this.canPurchase}}
      <h2>
        {{i18n "discourse_subscriptions.subscribe.card.title"}}
      </h2>

      <hr />

      <PaymentOptions
        @plans={{this.model.plans}}
        @selectedPlan={{this.selectedPlan}}
      />

      <hr />

      <SubscribeCard @cardElement={{this.cardElement}} />

      {{#if this.loading}}
        {{loading-spinner}}
      {{else if this.isAnonymous}}
        <LoginRequired />
      {{else}}
        <Input
          @type="text"
          name="cardholder_name"
          placeholder={{i18n
            "discourse_subscriptions.subscribe.cardholder_name"
          }}
          @value={{this.cardholderName}}
          class="subscribe-name"
        />
        <div class="address-fields">
          <SubscribeCountrySelect
            @value={{this.cardholderAddress.country}}
            @onChange={{action "changeCountry"}}
          />
          <Input
            @type="text"
            name="cardholder_postal_code"
            placeholder={{i18n
              "discourse_subscriptions.subscribe.cardholder_address.postal_code"
            }}
            @value={{this.cardholderAddress.postalCode}}
            class="subscribe-address-postal-code"
          />
        </div>
        <Input
          @type="text"
          name="cardholder_line1"
          placeholder={{i18n
            "discourse_subscriptions.subscribe.cardholder_address.line1"
          }}
          @value={{this.cardholderAddress.line1}}
          class="subscribe-address-line1"
        />
        <div class="address-fields">
          <Input
            @type="text"
            name="cardholder_city"
            placeholder={{i18n
              "discourse_subscriptions.subscribe.cardholder_address.city"
            }}
            @value={{this.cardholderAddress.city}}
            class="subscribe-address-city"
          />
          {{#if this.isCountryUS}}
            <SubscribeUsStateSelect
              @value={{this.cardholderAddress.state}}
              @onChange={{action "changeState"}}
            />
          {{else if this.isCountryCA}}
            <SubscribeCaProvinceSelect
              @value={{this.cardholderAddress.state}}
              @onChange={{action "changeState"}}
            />
          {{else}}
            <Input
              @type="text"
              name="cardholder_state"
              placeholder={{i18n
                "discourse_subscriptions.subscribe.cardholder_address.state"
              }}
              @value={{this.cardholderAddress.state}}
              class="subscribe-address-state"
            />
          {{/if}}
        </div>

        <Input
          @type="text"
          name="promo_code"
          placeholder={{i18n "discourse_subscriptions.subscribe.promo_code"}}
          @value={{this.promoCode}}
          class="subscribe-promo-code"
        />

        <DButton
          @disabled={{this.loading}}
          @action={{action "stripePaymentHandler"}}
          class="btn btn-primary btn-payment"
          @label="discourse_subscriptions.plans.payment_button"
        />
      {{/if}}
    {{else}}
      <h2>{{i18n "discourse_subscriptions.subscribe.already_purchased"}}</h2>

      <LinkTo
        @route="user.billing.subscriptions"
        @model={{this.currentUser.username}}
        class="btn btn-primary"
      >
        {{i18n "discourse_subscriptions.subscribe.go_to_billing"}}
      </LinkTo>
    {{/if}}
  </div>
</div>